<?php

head("K&P's Продукти");
menue();
$sql = "SELECT
			  c.catalog_id,
			  c.sef_url,
			  
			  d.title
			  
		  FROM
			  catalog AS c,
			  catalog_description AS d
		  WHERE
		  
			  c.catalog_id = d.catalog_id
			  
			  AND
			  c.published
			  AND
			  
			  d.lang_id = '1'
			  
			  ORDER BY c.order_number DESC
			";
			$result = query($sql);
?>
<div id="content" class="product">
		
		<div id="pathway">
			<a href="<?=HTML_BASE?>">начало</a>/
		</div>
		
		<h1>Продукти</h1>
		
		
		<div id="products">	
			<?php while ($row = mysql_fetch_object($result)) { 
			$sql_img = "SELECT image FROM
						catalog_image WHERE catalog_id = '".$row->catalog_id."' ORDER BY top DESC LIMIT 1 "; 
						
						$resimg = query($sql_img);
						$rimg = mysql_fetch_object($resimg);
						$dr = HTML_BASE."catalogimage/".$row->catalog_id."/";
						
			?>
                <a href="<?=HTML_BASE?>product/<?=$row->sef_url?>/">
                    <img src="<?=$dr?>th_<?=$rimg->image?>" alt="<?=$row->title?>">
                    <span><?=$row->title?></span>
                </a>
			<?php }?>
		</div>
	</div>
    <?php foot(); ?>
    
    
    
</body>
</html>

